<?php
abstract class MainObject {
	
	protected $_id = 0;

	protected $_model = null;
	
	public function save() {
		if($this->getId()) {
			$this->_update();
		}
		else {
			$this->_save();
		}
	}
	
	public function getId() {
		return $this->_id;
	}

	public function setId($id) {
		$this->_id = intval($id);
	}

	abstract protected function _save();

	abstract protected function _update();
}